#!/usr/bin/python
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
import rpcConfig
import serverFuncs
import taskManager


if __name__ == '__main__':
	# Restrict to a particular path.
	class RequestHandler(SimpleXMLRPCRequestHandler):
		rpc_paths = ('/RPC2',)

	# Create server
	server	= SimpleXMLRPCServer(("172.18.56.106", 8000), requestHandler=RequestHandler,logRequests = False)
	server.register_introspection_functions()
	tManager	= taskManager.taskManager(rpcConfig.taskFilePath, rpcConfig.logFilePath)
	tManager.taskLoad()
	server.register_instance(serverFuncs.serverFuncs(tManager))

	# Run the server's main loop
	server.serve_forever()
